<?php echo $this->element('body_help');?>
<?php echo $this->element('breadcrumb');?>
<div class="wrap">
<div id="icon-users" class="icon32"><br></div>
<h2>
	<?php __('Danh sách đề tài tốt nghiệp');?>
	<a class="button add-new-h2" href="<?php echo $this->webroot;?>projects/add"><?php __('Đăng ký mới');?></a>
</h2>
<?php echo $this->Session->flash();?>
<br/>

<form action="<?php echo $this->webroot;?>projects/index" method="post">
<div class="tablenav top">
	<div class="alignleft actions">
	<?php //Hiển thị danh sách năm thực hiện 
		if(isset($set_project_year)){
			$set_select_year = '';
			if(isset($set_year)){
				$set_select_year = $set_year;
			}
			echo $this->Form->input('project_year',array('options'=>$set_project_year,'value'=>$set_select_year,'label'=>''));
		}
	?>
	</div>
	<div class="alignleft actions">
	<?php //Hiển thị danh sách lĩnh vực thực hiện
		if(isset($set_project_category)){
			$set_select_category = '';
			if(isset($set_category)){
				$set_select_category = $set_category;
			}
			echo $this->Form->input('project_category',array('options'=>$set_project_category,'value'=>$set_select_category,'label'=>'','empty'=>'--Tất cả lĩnh vực--'));
		}
	?>
	</div>
	<div class="alignleft actions">
	<?php //Hiển thị danh sách Giáo viên hướng dẫn
		if(isset($set_teachers)){
			$set_select_teacher = '';
			if(isset($set_teacher)){
				$set_select_teacher = $set_teacher;
			}
			echo $this->Form->input('project_teacher',array('options'=>$set_teachers,'value'=>$set_select_teacher,'label'=>'','empty'=>'--Tất cả giáo viên HD--'));
		}
	?>
	
	</div>
	<input type="submit" value="Thực hiện" class="button-secondary action" id="doaction" name="">
<br class="clear">
</div>

<table class="wp-list-table widefat fixed users" cellspacing="0">
	<thead>
		<tr>
			<th scope="col" id="cb" class="manage-column column-cb check-column" style=""><input type="checkbox"></th>
			<th scope="col" id="name" class="manage-column column-name sortable desc" style="">
				<span><?php echo $this->Paginator->sort('Tên đề tài đăng ký','name');?></span></th>
			<th scope="col" id="name" class="manage-column column-name sortable desc" style="">
				<span><?php echo $this->Paginator->sort('Thông tin chi tiết','name');?></span></th>
			
			<th style="" class="manage-column column-date sortable asc" id="date" scope="col">
				<span><?php echo $this->Paginator->sort('Mã bảo vệ','security_code');?></span></th>
			<th style="" class="manage-column column-categories" id="categories" scope="col">
				<span><?php echo $this->Paginator->sort('Trạng thái','active');?></span></th>
		</tr>
	</thead>

	<tfoot>
		<tr>
			<th scope="col" id="cb" class="manage-column column-cb check-column" style=""><input type="checkbox"></th>
			<th scope="col" id="name" class="manage-column column-name sortable desc" style="">
				<span><?php echo $this->Paginator->sort('Tên đề tài đăng ký','name');?></span></th>
			<th scope="col" id="name" class="manage-column column-name sortable desc" style="">
				<span><?php echo $this->Paginator->sort('Thông tin chi tiết','name');?></span></th>
			<th style="" class="manage-column column-date sortable asc" id="date" scope="col">
				<span><?php echo $this->Paginator->sort('Mã bảo vệ','security_code');?></span></th>
			<th style="" class="manage-column column-categories" id="categories" scope="col">
				<span><?php echo $this->Paginator->sort('Trạng thái','active');?></span></th>
			</tr>
	</tfoot>

	<tbody id="the-list" class="list:user">
		<?php
			$i = 0;
			foreach ($projects as $project):
				$class = null;
				if ($i++ % 2 == 0) {
					$class = ' class="alternate"';
				}
				$id= $project['Project']['id'];
			?>
			<tr <?php echo $class;?>>
				<th scope="row" class="check-column"><input name="gourps_<?php echo $id;?>" id="gourps_<?php echo $id;?>" class="contributor" value="<?php echo $id;?>" type="checkbox"></th>
				<td class="username column-username">
					<!--img id="group_icon" alt="" src="<?php echo $this->webroot;?>img/project_categories.png" class="avatar avatar-32 grav-hashed grav-hijack" height="32" width="32"-->
					<strong>
					<?php echo $this->Html->link(__($project['Project']['name'], true), array('action' => 'view', $project['Project']['id'])); ?>&nbsp;
					</strong>
					<br/>
					<abbr title="Ngày đăng ký : <?php echo date("d-m-Y H:i:s",strtotime($project['Project']['created'])); ?>">(Ngày đăng ký :&nbsp;<?php echo date("d-m-Y H:i:s",strtotime($project['Project']['created'])); ?>)</abbr>
					<br>
					
					<div class="row-actions">
						<span class="remove">
							<?php echo $this->Html->link(__('Xem', true), array('action' => 'view', $project['Project']['id'])); ?>
						</span>&nbsp;|&nbsp;
						<span class="remove">
							<?php echo $this->Html->link(__('Sửa', true), array('action' => 'edit', $project['Project']['id'])); ?>
						</span>|&nbsp;
						<span class="remove">
							<?php echo $this->Html->link(__('Xóa', true), array('action' => 'delete', $project['Project']['id']), null, sprintf(__('Có muốn xóa # %s?', true), $project['Project']['name'])); ?>
						</span>
					</div>
				</td>
				<td>
						<div class="project_info">
							<ul>
								<li><span>Lĩnh vực</span>:<?php echo $project['ProjectCategory']['name'];?></li>
								<li title='Giáo viên hướng dẫn'>
									<span class="project_info_span">GVHD</span>:<?php echo $project['User']['name'];?>
								</li>
								<li><span class="project_info_span">SVTH<span>:vinh</li>
							</ul>
						</div>
				</td>				
				<td><?php echo $project['Project']['security_code']; ?>&nbsp;</td>
				<td class="categories column-categories">
					<div class="project_active">
						<ul>
							<li>
								<?php 
									if($project['Project']['active'] == '1'){;	?>	
										<a title='Năm đang thực thi' href="<?php echo $this->webroot.'schedules/set_active/'.$project['Project']['id']?>">
											Đã duyệt
										</a>
									<?php }else{;?>
										<a title='Năm không thực thi' href="<?php echo $this->webroot.'schedules/set_active/'.$project['Project']['id']?>">
											Chưa duyệt
										</a>
								<?php };?>&nbsp;
							</li>
							
							<li>
								<?php 
									if($project['Project']['isreported'] == '1'){;	?>	
										<a title='Năm đang thực thi' href="<?php echo $this->webroot.'schedules/set_active/'.$project['Project']['id']?>">
											Đã báo cáo
										</a>
									<?php }else{;?>
									<a title='Năm không thực thi' href="<?php echo $this->webroot.'schedules/set_active/'.$project['Project']['id']?>">
										Chưa báo cáo
									</a>
								<?php };?>&nbsp;
							</li>
						</div>
				</td>
			
			</tr>
		<?php endforeach; ?>	
	</tbody>
</table>
<div class="tablenav bottom">
	<div class="alignleft actions">
		<select name="action2">
			<option value="-1" selected="selected">Tác vụ</option>
			<option value="remove">Xóa</option>
		</select>
		<input name="" id="doaction2" class="button-secondary action" value="Thực hiện" type="submit">
	</div>
	<div class="tablenav-pages">
	<span class="displaying-num"><?php
	echo $this->Paginator->counter(array(
	'format' => __('Trang %page% của %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
	));
	?></span>
	<a href="#" title="Go to the first page" class="first-page"><?php echo $this->Paginator->prev(__('<<', true), array(), null, array('class'=>'disabled'));?></a>
	<span class="paging-input">| 	<?php echo $this->Paginator->numbers();?>
 |</span></span>
	<a href="#" title="Go to the last page" class="last-page"><?php echo $this->Paginator->next(__('>>', true), array(), null, array('class' => 'disabled'));?></a>
	</div>
</div>
</form>


<div class="actions">
	<h3><?php __('Actions'); ?></h3>
	<ul>
		<li><?php echo $this->Html->link(__('New Project', true), array('action' => 'add')); ?></li>
		<li><?php echo $this->Html->link(__('List Project Years', true), array('controller' => 'project_years', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Project Year', true), array('controller' => 'project_years', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Project Notes', true), array('controller' => 'project_notes', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Project Note', true), array('controller' => 'project_notes', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Project Reports', true), array('controller' => 'project_reports', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Project Report', true), array('controller' => 'project_reports', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Project Students', true), array('controller' => 'project_students', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Project Student', true), array('controller' => 'project_students', 'action' => 'add')); ?> </li>
	</ul>
</div>
<br class="clear">
<div class="clear"></div>
</div><!-- wrap -->